package cn.linkai.hadoop.hive;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class HiveConnection {
    private static Connection connection;

    static {
        try {
            Class.forName("org.apache.hive.jdbc.HiveDriver");
            connection=DriverManager.getConnection("jdbc:hive2://master:10000/test","hadoop","hadoop");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    private HiveConnection() {
    }

    public static synchronized Connection getInstance(){
        return connection;
    }
}
